package service_sys

import (
	"strings"
	"wrblog-api-go/app/dao/dao_sys"
	"wrblog-api-go/app/model/model_sys"
	"wrblog-api-go/pkg/utils"
)

func GetSysRolePageList(sysRole model_sys.SelectSysRole) ([]model_sys.SysRoleVo, int64) {
	return dao_sys.GetSysRolePageList(sysRole)
}

func GetSysRoleById(roleId int) (model_sys.SysRoleVo, error) {
	return dao_sys.GetSysRoleById(roleId)
}

func AddSysRole(sysRole model_sys.SysRolePo) (int, error) {
	sysRole.CreateTime = utils.NewTimeNow()
	return dao_sys.AddSysRole(sysRole)
}
func EditSysRole(sysRole model_sys.SysRolePo) (int64, error) {
	sysRole.UpdateTime = utils.NewTimeNow()
	return dao_sys.EditSysRole(sysRole)
}

func RemoveSysRole(roleIds string, uk string) (int64, error) {
	return dao_sys.RemoveSysRole(strings.Split(roleIds, ","), uk)
}
